package Hxw3DEngine.core.Resource.animation
{
	import Hxw3DEngine.core.Resource.animation.AnimationClipBase;
	import Hxw3DEngine.asset.parsers.bson.vo.SkeletonAnim;
	import Hxw3DEngine.core.materials.shader.SkinnedShader;
	import ao3s2.Flash3dLib.CModule;
	
	public class SkeletonAnimationClip extends AnimationClipBase
	{
		// 以下内容暂时没用。
		internal var frame_type:uint;
		internal var _duration:uint;
		internal var track_type:uint;
		internal var _joints:uint;
		internal var keyLength:uint;
		
		internal var _tracks:int;
		internal var _loop:Boolean;
		

		public function SkeletonAnimationClip(name:String,_vo:Object)
		{
			super(name,SkeletonAnim(_vo).frames);
			createFromVO(_vo);
		}
		
		override public function dispose():void
		{
			// 执行当前类实例的清理操作
			CModule.free(_tracks);
			_tracks = 0;
		}
		
		override public function createFromVO(_vo:Object):Boolean
		{
			var vo:SkeletonAnim = _vo as SkeletonAnim;
			
			frame_type = vo.frame_type;
			_duration = vo.duration;
			track_type = vo.track_type;
			_joints = vo.joints;
			keyLength = vo.keyLength;
			
			_tracks = CModule.malloc(vo.tracks.length);
			CModule.writeBytes(_tracks, vo.tracks.length, vo.tracks);
			
			return true;
		}
		
		public function get tracks():int 
		{
			return _tracks;
		}
		
		public function get joints():uint 
		{
			return _joints;
		}
	}
}